<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of ADCP_PlotBeamDepths</title>
  <meta name="keywords" content="ADCP_PlotBeamDepths">
  <meta name="description" content="This function plots the beam depths given a csv file output from VMT.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- ../menu.html trunk --><!-- menu.html utils -->
<h1>ADCP_PlotBeamDepths
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>This function plots the beam depths given a csv file output from VMT.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function ADCP_PlotBeamDepths </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">This function plots the beam depths given a csv file output from VMT.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function ADCP_PlotBeamDepths</a>
0002 
0003 <span class="comment">%This function plots the beam depths given a csv file output from VMT.</span>
0004 
0005 <span class="comment">%P.R. Jackson, 4-16-09</span>
0006 
0007 [file,path] = uigetfile({<span class="string">'*.txt;*.csv'</span>,<span class="string">'All Text Files'</span>; <span class="string">'*.*'</span>,<span class="string">'All Files'</span>},<span class="string">'Select Bathy Text File'</span>);
0008 infile = [path file];
0009 disp(<span class="string">'Loading Bathy File...'</span> );
0010 disp(infile);
0011 data = dlmread(infile);
0012 
0013 ens   = data(:,1);
0014 x     = data(:,2);
0015 y     = data(:,3);
0016 z     = data(:,4);
0017 
0018 <span class="comment">%Break out by beam (accepting only ensembles with all beams valid)</span>
0019 
0020 xb1 = [];
0021 xb2 = [];
0022 xb3 = [];
0023 xb4 = [];
0024 yb1 = [];
0025 yb2 = [];
0026 yb3 = [];
0027 yb4 = [];
0028 zb1 = [];
0029 zb2 = [];
0030 zb3 = [];
0031 zb4 = [];
0032 
0033 <span class="keyword">for</span> i = min(ens):1:max(ens)
0034     indx = find(ens == i);
0035     <span class="keyword">if</span> length(indx) == 4;
0036         xb1 = [xb1; x(indx(1))];
0037         xb2 = [xb2; x(indx(2))];
0038         xb3 = [xb3; x(indx(3))];
0039         xb4 = [xb4; x(indx(4))];
0040         yb1 = [yb1; y(indx(1))];
0041         yb2 = [yb2; y(indx(2))];
0042         yb3 = [yb3; y(indx(3))];
0043         yb4 = [yb4; y(indx(4))];
0044         zb1 = [zb1; z(indx(1))];
0045         zb2 = [zb2; z(indx(2))];
0046         zb3 = [zb3; z(indx(3))];
0047         zb4 = [zb4; z(indx(4))];
0048     <span class="keyword">end</span>
0049 <span class="keyword">end</span>
0050 
0051 <span class="comment">%Now compute distances from start for each beam</span>
0052 
0053 db1 = sqrt((xb1(1) - xb1).^2 + (yb1(1) - yb1).^2);
0054 db2 = sqrt((xb2(1) - xb2).^2 + (yb2(1) - yb2).^2);
0055 db3 = sqrt((xb3(1) - xb3).^2 + (yb3(1) - yb3).^2);
0056 db4 = sqrt((xb4(1) - xb4).^2 + (yb4(1) - yb4).^2);
0057 
0058 <span class="comment">%Plot</span>
0059 
0060 figure(1); clf
0061 plot(db1,zb1,<span class="string">'k-'</span>,<span class="string">'LineWidth'</span>,2); hold on
0062 plot(db2,zb2,<span class="string">'r-'</span>,<span class="string">'LineWidth'</span>,2); hold on
0063 plot(db3,zb3,<span class="string">'b-'</span>,<span class="string">'LineWidth'</span>,2); hold on
0064 plot(db4,zb4,<span class="string">'g-'</span>,<span class="string">'LineWidth'</span>,2); hold on
0065 xlabel(<span class="string">'Distance (m)'</span>)
0066 ylabel(<span class="string">'Depth (m)'</span>)
0067 
0068 legend(<span class="string">'beam 1'</span>,<span class="string">'beam 2'</span>,<span class="string">'beam 3'</span>,<span class="string">'beam 4'</span>,<span class="string">'Location'</span>,<span class="string">'SouthEast'</span>)
0069 
0070 
0071 <span class="comment">%Output the data</span>
0072 <span class="keyword">if</span> 1
0073     outmat = [db1 db2 db3 db4 zb1 zb2 zb3 zb4];
0074     dlmwrite([infile(1:end-4) <span class="string">'_BeamXS.csv'</span>],outmat)
0075 <span class="keyword">end</span>
0076         
0077</pre></div>
<hr><address>Generated on Wed 04-Jun-2014 14:21:02 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>